package com.lzj.service;

import com.lzj.dao.DepartmentMapper;
import com.lzj.entity.Department;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *
 * </p>
 *
 * @autor:lzj
 * @date:2022/2/26
 */
@Service
public class DepartmentServiceImpl implements DepartmentService{
    @Autowired
    private DepartmentMapper departmentMapper;

    public void setDepartmentMapper(DepartmentMapper departmentMapper) {
        this.departmentMapper = departmentMapper;
    }

    @Override
    public Department getDepById(int id) {
        return departmentMapper.getDepById(id);
    }

    @Override
    public List<Department> getAllDeps() {
        return departmentMapper.getAllDeps();
    }

    @Override
    public int addDepartment(String departmentname) {
        return departmentMapper.addDepartment(departmentname);
    }

    @Override
    public Department getDepByName(String departmentname) {
        return departmentMapper.getDepByName(departmentname);
    }

    @Override
    public int deleteDep(int id) {
        return departmentMapper.deleteDep(id);
    }

    @Override
    public int updateDep(int id, String name) {
        return departmentMapper.updateDep(id,name);
    }
}
